package com.akka.actor

import scala.actors.{Actor => ScalaActor}

object SillyActor extends ScalaActor {
  def act(){
    for(i <- 0 to 5){
      println("I am acting");
      Thread.sleep(100)
    }
  }
}
object SeriousActor extends ScalaActor {
  def act(){
//    var run = true;
//    while(run){
//      println(run)
//      val r = receive {
//        case "exit"=>println("exit");None
//        case m => println(m); "response:"+m
//      }
//      if(r==None) run = false;
//      else println(r);
//    }
  }
}
class HelloActor extends ScalaActor{
  def act(){
      react {
        case "exit" => println("exit system")
        case m => println("react "+m)
      }
      act
  }
}

object HelloActor extends App {
  val hello = new HelloActor
  hello ! "Hello"
  hello ! "Hello"
  hello ! "Hello"
  hello ! "Hello"
  hello ! "Hello"
  hello ! "exit"
  hello.start
 }